[DEFAULT]
debug = {{ gnocchi_logging_debug }}

log_dir = /var/log/kolla/gnocchi

{% if enable_redis | bool %}
coordination_url = {{ redis_connection_string }}
{% endif %}

{% if service_name == 'gnocchi-api' %}
# Force gnocchi-api.log or will use app.wsgi
log_file = /var/log/kolla/gnocchi/gnocchi-api.log
{% endif %}

[api]
port = {{ gnocchi_api_listen_port }}
host = {{ api_interface_address }}
middlewares = keystonemiddleware.auth_token.AuthProtocol
auth_mode = keystone

[oslo_middleware]
enable_proxy_headers_parsing = true

[database]
connection = mysql+pymysql://{{ gnocchi_database_user }}:{{ gnocchi_database_password }}@{{ gnocchi_database_address }}/{{ gnocchi_database_name }}
connection_recycle_time = {{ database_connection_recycle_time }}
max_overflow = 1000
max_pool_size = {{ database_max_pool_size }}
max_retries = -1

{% if enable_gnocchi_statsd | bool %}
[statsd]
resource_id = {{ gnocchi_resource_id }}
user_id = {{ gnocchi_user_id }}
project_id = {{ gnocchi_project_id }}
archive_policy_name = low
flush_delay = 10
{% endif %}

[metricd]
workers = {{ gnocchi_metricd_workers }}

[indexer]
url = mysql+pymysql://{{ gnocchi_database_user }}:{{ gnocchi_database_password }}@{{ gnocchi_database_address }}/{{ gnocchi_database_name }}

[keystone_authtoken]
service_type = metric
www_authenticate_uri = {{ keystone_public_url }}
project_domain_id = {{ default_project_domain_id }}
project_name = service
user_domain_id = {{ default_user_domain_id }}
username = {{ gnocchi_keystone_user }}
password = {{ gnocchi_keystone_password }}
auth_url = {{ keystone_internal_url }}
auth_type = password
cafile = {{ openstack_cacert }}
region_name = {{ openstack_region_name }}

memcache_security_strategy = {{ memcache_security_strategy }}
memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ 'api' | kolla_address(host) | put_address_in_context('memcache') }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}

{% if gnocchi_policy_file is defined %}
[oslo_policy]
policy_file = {{ gnocchi_policy_file }}
{% endif %}

[incoming]
{% if gnocchi_incoming_storage == 'redis' %}
driver = redis
redis_url = {{ redis_connection_string }}
{% endif %}

[storage]
{% if gnocchi_backend_storage == 'file' %}
driver = file
file_basepath = /var/lib/gnocchi
{% elif gnocchi_backend_storage == 'ceph' %}
driver = ceph
ceph_pool = {{ ceph_gnocchi_pool_name }}
ceph_username = {{ ceph_gnocchi_user }}
ceph_keyring = /etc/ceph/{{ ceph_cluster }}.client.{{ ceph_gnocchi_user }}.keyring
ceph_conffile = /etc/ceph/{{ ceph_cluster }}.conf
{% endif %}

{% if enable_grafana | bool %}
[cors]
allowed_origin = {{ grafana_public_endpoint }}
{% endif %}

[oslo_concurrency]
lock_path = /var/lib/gnocchi/tmp
